package com.hyt.it.ogt.kq.service.bm.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.it.ogt.kq.service.bm.model.entity.ProjectSubject;
import com.hyt.it.ogt.kq.service.bm.model.entity.StudentSubject;
import com.hyt.it.ogt.kq.service.bm.model.vo.*;

import java.util.List;
import java.util.Optional;

/**
 * <p>
 * 考生报名科目表 服务类
 * </p>
 *
 * @author wangt
 * @since 2020-05-15
 */
public interface IStudentSubjectService extends IService<StudentSubject> {

    List<ProjectSubject> getSubjectList(String projectId, String regId, String status);

    String getStudentId(String regId, String projectId);

    boolean delete(String studentId, String projectId, String subjectId);

	ApiResponse<String> addStudentSubject(SubjectVo subjectVo);

    ApiResponse<String> deleteStudentSubject(StudentSubjectVo studentSubjectVo);

    public IPage<StudentListVo> getStudentList(StudentInfoParam param);

    long getStudentListCount(String queryStr, String projectId, String auditState);

    void deleteStudentSubject(String studentId, String subjectId);

    void deleteStudent(String projectId, String studentId) throws Exception;

    void updateStudentAudit(String studentId, String projectId);

    List<StudentSubject> getStudentSbjects(String projectId, String studentId);

    StudentSubject getStudentSbject(String subjectId, String studentId, String projectId);

    void updateKwflag(String subjectId, String projectId, String kwFlag);

    void updateStudentFlag(List<KwStudentVo> list) throws Exception;

    List<StudentStatVo> statByExamId(String examId);

    List<StudentSubject> queryStudentSubject(String isAudit, String isPay, String subjectId, String studentId, List<String> permissionList, String projectId);

    List<PayStatVo> statPayByProjectId(String projectId, List<String> permissionList, String deptId);

    List<StudentSubject> queryRegSubject(String regId, String projectId);

    ProjectStatVo getProjectApplyNum(String projectId, String deptId);

    /**
     * 获取区域下已报名人次
     *
     * @param projectId         报名ID
     * @param areaCollectInfoId 区域采集字段ID
     * @param areaCode          区域code
     * @param deptId
     * @return
     */
    Optional<Integer> countAreaPersonTimeNum(String projectId, String areaCollectInfoId, String areaCode, String deptId);

    /**
     * 获取已报名人次
     *
     * @param projectId 报名ID
     * @param deptId
     * @return
     */
    Optional<Integer> countPersonTimeNum(String projectId, String deptId);

    /**
     * 校验科目的报考人数是否超过最大报考科目数配置
     *
     * @param projectId
     * @param subjectId
     * @return
     */
    Boolean validateStudentSubjectRegistNum(String projectId, String subjectId);
    

    /**
     * 获取考生科目通过考试ID
     *
     * @param studentIds
     * @return
     */
    List<StudentSubject> listByStudentIds(List<String> studentIds);

    /**
     * 获取考生科目通过考试ID
     *
     * @param studentId
     * @return
     */
    List<StudentSubject> listByStudentId(String studentId);

    /**
     * 获取考生科目拼接
     *
     * @return
     */
    ApiResponse<String> commitStudentSubjectApi(SubjectVo subjectVo);
    
    
    String getCommaByStudentId(String studentId);

    /**
     * 提交考生的科目信息
     *
     * @param subjectVo
     * @return
     */
    ApiResponse<String> commitStudentSubjectApi(SubjectVo subjectVo, List<StudentSubject> subjectList);

    Integer countBySubjectId(String subjectId);

    /**
     * 获取科目报考数
     *
     * @param projectId
     * @param subjectId
     * @return
     */
    Integer countBySubjectId(String projectId, String subjectId);


    /***
     *
     * 获取报考项目下考生所有的报考科目列表
     * @param projectId
     * @return
     */
    List<StudentSubjectExportVo> getStudentSubjectNamesByProjectId(String projectId);
    
    
    /**
     * 校验科目的报考人数是否超过最大报考科目数配置
     *
     * @param subjectId
     * @return
     */
    Boolean validateStudentSubjectRegistNum(String subjectId);

    /**
     * 通过用户ID和报名ID查询考生的报名资格
     *
     * @param projectId
     * @param userId
     * @return
     */
    List<String> getQualificationSubject(String projectId, String userId);
}
